<template>
  <div class="box">
    <h3>汇总信息</h3>
    <el-row :gutter="20">
      <el-col :span="12">
        <el-card>
          <div slot="header">
            <span style="font-weight: bold">销量排行</span>
          </div>
          <MyChart type="Bar" :height="300" :xAxis="barAxis" :series="barSeries" />
          <!-- <Bar :height="300" :xAxis="barAxis" :series="barSeries" /> -->
        </el-card>
      </el-col>
      <el-col :span="12">
        <el-card>
          <div slot="header">
            <span style="font-weight: bold">商品排行</span>
          </div>
          <MyChart type="MyLine" :height="300" :xAxis="lineAxis" :series="lineSeries" />
          <!-- <MyLine :height="300" :xAxis="lineAxis" :series="lineSeries" /> -->
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { randomColor } from '@/utils/tools'
export default {
  data() {
    return {
      barAxis: ['张三', '李四', '王五'],
      // legend: ['销量1', '销量2'],
      // legend: [],
      barSeries: [
        {
          type: 'bar',
          name: '销量1',
          data: [100, 200, 300].map(item => ({
            value: item,
            itemStyle: {
              color: randomColor()
            }
          }))
        },
        {
          type: 'bar',
          name: '销量2',
          itemStyle: {
            color: '#a90000'
          },
          data: [150, 200, 300]
        }
      ],
      lineAxis: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
      lineSeries: [
        {
          lineStyle: {
            color: randomColor()
          },
          data: [820, 932, 901, 934, 1290, 1330, 1320],
          type: 'line',
          smooth: true
        }
      ]
    }
  }
}
</script>

<style lang="scss" scoped>
.box {
  padding: 10px;
  overflow-x: hidden;
}
</style>
